package ThreadTest;
/*
获取当前线程对象
 */
public class ThreadTest4 {
    public static void main(String[] args) {
        Thread main = Thread.currentThread();
        MyThread4 myThread4 = new MyThread4();
        myThread4.start();
        for(int i = 0; i < 10; i++){
            System.out.println(main.getName()+"--->"+i);
        }
    }
}
class MyThread4 extends Thread{
    public void run(){
        for(int i = 0; i < 10; i++){
            System.out.println(Thread.currentThread().getName()+"--->"+i);
        }
    }
}
